const Koa = require('koa');

const serve = require('koa-static');
const path = require('path');

const DtFmt = require('./util/DtFmt')

const router = require("./router")

const app = new Koa();

const PORT = 3000

console.log("http://localhost:" + PORT);



// demos/08.js
// const logger = (ctx, next) => {
//     console.log("start", ` ${DtFmt.full(new Date())} ${ctx.request.method} ${ctx.request.url}`);
//     next();
//     console.log("stop", ` ${DtFmt.hms(Date.now())} ${ctx.request.method} ${ctx.request.url}`);
// }
// app.use(logger);


app
  .use(router.routes())
  .use(router.allowedMethods());





// new Router();


// app.use(route.get('/', main));
// app.use(route.get('/about', about));






// const stamain = serve(path.join(__dirname));
// app.use(stamain);



app.listen(PORT);
